package com.origon.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;


/**
 * The persistent class for the address database table.
 * 
 */
@Entity
public class Address implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String id;

	private String city;

	private String postalCode;

	private String postBox;

	private String state;

	private String street;

	//bi-directional many-to-one association to Country
	@ManyToOne
	@JoinColumn(name="CountryId")
	private Country country;

	//bi-directional many-to-one association to Shop
	@OneToMany(mappedBy="billingAddress")
	private List<Shop> shops1;

	//bi-directional many-to-one association to Shop
	@OneToMany(mappedBy="billingAddress")
	private List<Shop> shops2;

	//bi-directional many-to-one association to User
	@OneToMany(mappedBy="billingAddress")
	private List<User> users1;

	//bi-directional many-to-one association to User
	@OneToMany(mappedBy="shippingAddress")
	private List<User> users2;

	public Address() {
		setId(UUID.randomUUID().toString());
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getPostalCode() {
		return this.postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	public String getPostBox() {
		return this.postBox;
	}

	public void setPostBox(String postBox) {
		this.postBox = postBox;
	}

	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getStreet() {
		return this.street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public Country getCountry() {
		return this.country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public List<Shop> getShops1() {
		return this.shops1;
	}

	public void setShops1(List<Shop> shops1) {
		this.shops1 = shops1;
	}

	public Shop addShops1(Shop shops1) {
		getShops1().add(shops1);
		shops1.setBillingAddress(this);

		return shops1;
	}

	public Shop removeShops1(Shop shops1) {
		getShops1().remove(shops1);
		shops1.setBillingAddress(null);

		return shops1;
	}

	public List<Shop> getShops2() {
		return this.shops2;
	}

	public void setShops2(List<Shop> shops2) {
		this.shops2 = shops2;
	}

	public Shop addShops2(Shop shops2) {
		getShops2().add(shops2);
		shops2.setShippingAddress(this);

		return shops2;
	}

	public Shop removeShops2(Shop shops2) {
		getShops2().remove(shops2);
		shops2.setShippingAddress(null);

		return shops2;
	}

	public List<User> getUsers1() {
		return this.users1;
	}

	public void setUsers1(List<User> users1) {
		this.users1 = users1;
	}

	public User addUsers1(User users1) {
		getUsers1().add(users1);
		users1.setBillingAddress(this);

		return users1;
	}

	public User removeUsers1(User users1) {
		getUsers1().remove(users1);
		users1.setBillingAddress(null);

		return users1;
	}

	public List<User> getUsers2() {
		return this.users2;
	}

	public void setUsers2(List<User> users2) {
		this.users2 = users2;
	}

	public User addUsers2(User users2) {
		getUsers2().add(users2);
		users2.setShippingAddress(this);

		return users2;
	}

	public User removeUsers2(User users2) {
		getUsers2().remove(users2);
		users2.setShippingAddress(null);

		return users2;
	}

}